package xyz.longicorn.driver.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import xyz.longicorn.driver.config.RabbitConfig;

import java.util.Map;

@Component
@RabbitListener(queues = RabbitConfig.RABBITMQ_DEFAULT_TOPIC) // 设置要监听队列的主题名称
@Slf4j
public class RabbitMessageConsumer {
    // 处理消息的方法 参数取决去发送消息的数据类型
    @RabbitHandler
    public void processMessage(Map<String, Object> map) {
        log.info("获取到一条消息:" + map.toString());
    }
}
